package com.hospital.hospitalsystem.base;


import javax.ws.rs.DefaultValue;
import javax.ws.rs.QueryParam;
import java.io.Serializable;

public class PageParam implements Serializable {

    @DefaultValue("1")
    @QueryParam("currentPage")
    private Integer currentPage = 1;

    @DefaultValue("20")
    @QueryParam("pageSize")
    private Integer pageSize = 20;

    public PageParam() {
    }

    public PageParam(Integer currentPage, Integer pageSize) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
    }

    public Integer getCurrentPage() {
        return this.currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        if (currentPage == null) {
            currentPage = 1;
        }

        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(Integer pageSize) {
        if (pageSize == null) {
            pageSize = 20;
        }

        this.pageSize = pageSize;
    }
}
